package com.spring.sunflower.common

import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.widget.RelativeLayout
import com.spring.sunflower.R
import com.spring.sunflower.base.BaseCompatActivity
import com.spring.sunflower.constant.Constant
import com.spring.sunflower.conversation.ChatActivity
import com.spring.sunflower.dialog.OnDialogSelectListener
import com.tencent.imsdk.v2.V2TIMCallback
import com.tencent.imsdk.v2.V2TIMManager

/**
 * Created by Kevin on 2021/9/27<br/>
 *
 * Describe:<br/>
 * 私信设置
 */
class HelpCenterActivity : BaseCompatActivity() {
    private var rlHelp: RelativeLayout? = null
    override fun getLayoutID(): Int = R.layout.activity_help_center

    override fun initView() {
        tvTitle.text = "帮助中心"
        rlHelp = findViewById(R.id.rlHelp)
        rlHelp!!.setOnClickListener {
            goOfficialService();
        }
    }

    private fun goOfficialService() {
        val intent = Intent(this, ChatActivity::class.java)
        intent.putExtra(Constant.IS_FROM_HELP, true)
        intent.putExtra(Constant.C2C_CONVERSATION_ID, Constant.OFFICIAL_SERVICE_C2C_CONVERSATION_ID)
        intent.putExtra(Constant.C2C_USER_ID, Constant.OFFICIAL_USER_ID_SERVICE)
        intent.putExtra(Constant.C2C_SHOW_NAME, "在线客服")
        intent.putExtra(Constant.C2C_DRAFT_TEXT, "")
        intent.putExtra(Constant.C2C_FACE_URL, Constant.OFFICIAL_SERVICE_AVATAR)
        startActivity(intent)
        markMessageRead(Constant.OFFICIAL_USER_ID_SERVICE)
    }

    fun markMessageRead(userID: String?) {
        V2TIMManager.getMessageManager().markC2CMessageAsRead(userID, object : V2TIMCallback {
            override fun onError(code: Int, desc: String) {}
            override fun onSuccess() {}
        })
    }
}